package main

import (
	"fmt"
	"net"
)

func main() {
	listen, err := net.Listen("tcp", "localhost:9527")

	if err != nil {
		fmt.Println("Error listen", err.Error())
		return
	}

	for {
		conn, err := listen.Accept()
		if err != nil {
			return
		}

		go doServerStuff(conn)
	}
}


func doServerStuff(conn net.Conn) {
	for {
		buf := make([]byte, 512)
		l, err := conn.Read(buf)
		if err != nil {
			fmt.Println("Error reading", err.Error())
			return
		}
		fmt.Printf("Received data: %v\n", string(buf[:l]))
	}
}
